home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / x / gui / x3d.lha / x3d / Q_and_A < prev    next >
Encoding:
Text File  |  1992-10-05  |  3.5 KB  |  182 lines

  1.  
  2. 1) What is the x3d version 2.0 .obj file format?
  3.  
  4. Example:
  5.  
  6.         
  7.        +---+
  8.       /   /| 
  9.      +___+ |
  10.      |   | +
  11.      |   |/
  12.      +___+
  13.  
  14.  
  15.      consider a simple cube with faces:
  16.  
  17. # top
  18.  
  19.   0 255   0 # green
  20.  
  21.  1000  1000  1000
  22. -1000  1000  1000
  23.  1000 -1000  1000
  24. -1000 -1000  1000
  25.  
  26. # bottom
  27.  
  28.   0   0 255 # blue 
  29.  
  30.  1000  1000 -1000
  31. -1000  1000 -1000
  32.  1000 -1000 -1000
  33. -1000 -1000 -1000
  34.  
  35. # right side 
  36.  
  37. 255   0   0 # red 
  38.  
  39.  1000  1000  1000
  40.  1000  1000 -1000
  41.  1000 -1000  1000
  42.  1000 -1000 -1000
  43.  
  44. # left side 
  45.  
  46. 255 255 255 # white
  47.  
  48. -1000  1000  1000
  49. -1000  1000 -1000
  50. -1000 -1000  1000
  51. -1000 -1000 -1000
  52.  
  53. # back 
  54.  
  55. 128   0 255 # purple
  56.  
  57.  1000  1000  1000
  58.  1000  1000 -1000
  59. -1000  1000  1000
  60. -1000  1000 -1000
  61.  
  62. # front 
  63.  
  64. 255 128   0 # orange
  65.  
  66.  1000 -1000  1000
  67.  1000 -1000 -1000
  68. -1000 -1000  1000
  69. -1000 -1000 -1000
  70.  
  71.  
  72.  
  73. The corresponding .obj file generated by the hull utility would be:
  74.  
  75.  
  76.  
  77. # x3d 2.0 object file generated by hull using cube.poly
  78.  
  79. # number of colors used in object
  80.  
  81. 6
  82.  
  83. # colors used in object (color number red green blue)
  84.  
  85. 0   0 255 0
  86. 1   0 0 255
  87. 2   255 0 0
  88. 3   255 255 255
  89. 4   128 0 255
  90. 5   255 128 0
  91.  
  92. # number of points used in object
  93.  
  94. 8
  95.  
  96. # points used in object (point number x y z)
  97.  
  98. 0   -1000.000000 -1000.000000 -1000.000000
  99. 1   -1000.000000 -1000.000000 1000.000000
  100. 2   -1000.000000 1000.000000 -1000.000000
  101. 3   -1000.000000 1000.000000 1000.000000
  102. 4   1000.000000 -1000.000000 -1000.000000
  103. 5   1000.000000 -1000.000000 1000.000000
  104. 6   1000.000000 1000.000000 -1000.000000
  105. 7   1000.000000 1000.000000 1000.000000
  106.  
  107. # number segments used in object
  108.  
  109. 12
  110.  
  111. # segments used in object (segment number color p q)
  112.  
  113. 0   0   5 7
  114. 1   0   7 3
  115. 2   1   6 2
  116. 3   1   4 6
  117. 4   3   2 3
  118. 5   3   0 2
  119. 6   3   1 0
  120. 7   3   3 1
  121. 8   4   6 7
  122. 9   5   0 4
  123. 10   5   5 1
  124. 11   5   4 5
  125.  
  126. # number of polygons used in object
  127.  
  128. 6
  129.  
  130. # polygons used in object (polygon number color
  131. # number of segments in polygon s0 s1 s2 ... sn)
  132.  
  133. 0   0   4   1 7 10 0
  134. 1   1   4   2 5 9 3
  135. 2   2   4   0 11 3 8
  136. 3   3   4   7 6 5 4
  137. 4   4   4   1 4 2 8
  138. 5   5   4   10 6 9 11
  139.  
  140.  
  141.  
  142. Things to note:
  143.  
  144.    Polygons are specified as sets of coplaner points that specify a 
  145.    convex polygon.  If the points are not coplaner or do not form a 
  146.    convex polygon the hull utility will still generate output anyway
  147.    but my programs might generate wrong answers when the information 
  148.    is used.
  149.  
  150.    Colors have been added to x3d 2.0, every segment and polygon gets
  151.    a single color associated with it.  The colors are used in various
  152.    new display modes.
  153.  
  154.    The hull utility attempts to reduce the number of points and
  155.    segments used to represent the object.  It should only keep one
  156.    copy of identical points and segments.  It does not merge colinear
  157.    line segments. 
  158.  
  159.    The "#" character may now be used to start comment lines in all files
  160.    x3d and hull use.
  161.  
  162.  
  163.  
  164. 2) How did I generate my .obj files?
  165.  
  166.   Each object has a comment indicating its source at its beginning. 
  167.   Some of the objects I included with x3d were created with
  168.   an animation/renderer interpreter that a friend of mine, Abe Megahed, and
  169.   I are working on.
  170.  
  171.   In the /pub/rendered_objs on castlab (144.92.60.140) are a few examples of
  172.   the images that were made with a previous renderd Abe wrote (xdart).
  173.   They are all in miff format and require the ImageMagick image manipulation
  174.   software which is found as /pub/ImageMagick2.0.tar.Z  which is my favorite
  175.   set of image utilities.
  176.  
  177.   The binaries for xdart are available for serveral machines types on castlab
  178.   as well.
  179.   
  180.   I really encourage you to at least try TOYS2_SS.miff out, particularly
  181.   if you have a 24 bit display.
  182.